package jzqb.service.impl;

import haha.life.common.SysTool;
import jzqb.dao.ILCDao;
import jzqb.po.LCPo;
import jzqb.service.ILCService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Description:
 *
 * @author BaiGe
 * @date: 2021/6/23 15:39
 * @Version 1.0
 */
@Service
public class LCServiceImpl implements ILCService {
    @Autowired
    private ILCDao ilcDao;
    @Override
    public Boolean addThreeLc(Integer qbfwId,String deptLeaderId,String qbDeptLeaderId,String qbManagerTargetUser,String qbManagerTargetGroup) {
        String nowTime = SysTool.getCurrentTime(SysTool.dateFormat_milli);

        LCPo lcPo1 = new LCPo("", qbfwId, deptLeaderId, "", 0, "", null,1, "", 0, "", nowTime, "");
        LCPo lcPo2 = new LCPo("", qbfwId, qbDeptLeaderId, "", 0, "", null,2, "", 0, "", nowTime, "");
        LCPo lcPo3 = new LCPo("", qbfwId, qbManagerTargetUser, qbManagerTargetGroup, 1, "",null, 3, "", 0, "", nowTime, "");

        Boolean bl1 = ilcDao.addLc(lcPo1);
        Boolean bl2 = ilcDao.addLc(lcPo2);
        Boolean bl3 = ilcDao.addLc(lcPo3);

        return bl1 && bl2 && bl3;
    }

    @Override
    public Boolean updateLc(LCPo lcPo) {
        lcPo.setUpdateTime(SysTool.getCurrentTime(SysTool.dateFormat_milli));
        return ilcDao.updateLc(lcPo);
    }

    @Override
    public Boolean delThreeLc(Integer qbfwId) {
        return ilcDao.delThreeLc(qbfwId);
    }
}
